using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GomokuGame
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            // 检查是否有命令行参数
            var args = Environment.GetCommandLineArgs();
            
            if (args.Length > 1)
            {
                switch (args[1].ToLower())
                {
                    case "test":
                        // 运行AI测试
                        RunAITest().Wait();
                        break;
                    case "demo":
                        // 运行演示
                        RunDemo().Wait();
                        break;
                    case "quick":
                        // 运行快速测试
                        QuickTest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "record":
                        // 运行记录测试
                        RecordTest.Test().Wait();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "simplerecord":
                        // 运行简单记录测试
                        SimpleRecordTest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "settings":
                        // 运行设置测试
                        SettingsTest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "aitest":
                        // 运行AI测试
                        DirectAITest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "tactical":
                        // 运行AI战术测试
                        AITacticalTest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    case "simple":
                        // 运行简单AI战术测试
                        SimpleTacticalTest.Test();
                        Console.WriteLine("\n按任意键退出...");
                        Console.ReadKey();
                        break;
                    default:
                        // 运行正常的Windows Forms应用程序
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new Form1());
                        break;
                }
            }
            else
            {
                // 运行正常的Windows Forms应用程序
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }

        /// <summary>
        /// 运行AI测试
        /// </summary>
        private static async Task RunAITest()
        {
            await AITest.TestAI();
            Console.WriteLine("\n按任意键退出...");
            Console.ReadKey();
        }

        /// <summary>
        /// 运行演示
        /// </summary>
        private static async Task RunDemo()
        {
            await Demo.RunDemo();
            Console.WriteLine("\n按任意键退出...");
            Console.ReadKey();
        }
    }
} 